<?php

/**
 * Description of actionsEnterRace
 *
 * @author MariiTeheran
 */

class actionsEnterRace {
    private $conx;
    private $race = "SELECT max(racecod) FROM RACE";
    private $racenum = 0;
    
    public function __construct() {
        $this->conx = null;
    }
    
    public function thisrace(){
        $consult = sprintf($this->race, $num);
        $this->conx = new conexion();
        $result = pg_exec($this->conx->getConexionDB(), $consult);
        $this->conx->closeConexionDB();
        $this->conx = null;
        $date = pg_fetch_assoc($result);
        $val = $date['max'];
        if($val == " "){
            $this->racenum = 1;
        } else {
            $this->racenum = $val + 1;
        }
        return $this->racenum;
    }
}

?>
